<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page session="false" contentType="text/html; charset=UTF-8"%>
<html>
<head>
<title>Home</title>
<script>
	function getmedia(id, filename) {
		window.location.href = "../report/getmedia?id=" + id + "&filename="
				+ filename;
	}
	function verify(id) {
		window.location.href = "verify?id=" + id;
	}
</script>
</head>
<body>
	<h1>Hello world!</h1>

	<P>The time on the server is ${serverTime}.</P>
	<table>
		<thead>
			<tr>
				<th>用户名</th>
				<th>事件类型</th>
				<th>事件内容</th>
				<th>地址</th>
				<th>发送给</th>
				<th>发送时间</th>
				<th>事件状态</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${items }" var="item">
				<tr>
					<td>${item.user }</td>
					<td><c:choose>
							<c:when test="${item.type == '1' }">
					文本
					</c:when>
							<c:when test="${item.type == '2' }">
					录音
					</c:when>
							<c:when test="${item.type == '3' }">
					图片
					</c:when>
							<c:when test="${item.type == '4' }">
					电话
					</c:when>
							<c:otherwise>其他</c:otherwise>
						</c:choose></td>
					<td><c:choose>
							<c:when test="${item.type == '1' }">
					${item.content }
					</c:when>
							<c:when test="${item.type == '4'} ">
					拨打电话
					</c:when>
							<c:otherwise>
								<a href="javascript:void(0);"
									onclick="getmedia('${item.id}', '${item.filename }')">${item.filename }</a>
							</c:otherwise>
						</c:choose></td>
					<td>${item.position }</td>
					<td>${item.touser }</td>
					<td><fmt:formatDate value="${item.createtime }"
							pattern="yyyy-MM-dd HH:mm:ss" /></td>
					<td><c:choose>
							<c:when test="${item.status == '0' }">
							未审核
						</c:when>
							<c:otherwise>
							已审核
						</c:otherwise>
						</c:choose></td>
					<td><c:if test="${item.status == '0' }">
							<a href="javascript:void(0);" onclick="verify('${item.id}')">审核</a>
						</c:if></td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
</body>
</html>
